﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Text;

namespace Mall.Order
{
    public partial class Order_Views : System.Web.UI.Page
    {
        public string member_order_view_Listall_html = string.Empty;
        protected void Page_Load(object sender, EventArgs e)
        {
            string id = Request["id"] == null ? "" : Request["id"].ToString();

            BLL.Models.MOrderModels models_morder = new BLL.Models.MOrderModels();
            BLL.Models.ProductModels models_product = new BLL.Models.ProductModels();
            StringBuilder str_html = new StringBuilder();
            MODEL.MOrder model_order = new MODEL.MOrder();
            model_order = models_morder.GetorderById(id);
            DataTable dt = new DataTable();
            dt = models_morder.GetOrderMoreById(id);
            foreach (DataRow dr in dt.Rows)
            {



                MODEL.MProduct model_product = new MODEL.MProduct();
                model_product = models_product.GetProductById(dr["productid"].ToString());
                str_html.Append("<tr bgcolor='#FFFFFF' height='30'><td align='center' valign='middle'>");
                str_html.Append("<a href='/index/views?productid=");
                str_html.Append(model_product.Id.ToString());
                str_html.Append("'>");
                str_html.Append(model_product.ProductName);
                str_html.Append("</a></td><td>");
                string[] tempstr = dr["ProductMoreInfo"].ToString().Split(new string[] { "{$yc$}" }, StringSplitOptions.None);
                str_html.Append(tempstr[0]);
                str_html.Append("</td><td>");
                str_html.Append(tempstr[1]);
                str_html.Append("</td><td>");
                str_html.Append(model_product.Price.ToString());
                str_html.Append("</td><td>");
                str_html.Append(dr["count"].ToString());
                str_html.Append("</td></tr>");


            }
            member_order_view_Listall_html = str_html.ToString();
            //TempData["member_order_view_Listall_html"] = member_order_view_Listall_html;
            
        }
    }
}